<?php

/**
 * ElearningCard form base class.
 *
 * @package    elearning
 * @subpackage form
 * @author     Your name here
 */
class BaseElearningCardForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'std_id'              => new sfWidgetFormInput(),
      'class_id'            => new sfWidgetFormInput(),
      'card_serial_number'  => new sfWidgetFormInput(),
      'note'                => new sfWidgetFormTextarea(),
      'el_card_active_time' => new sfWidgetFormDateTime(),
      'el_card_status'      => new sfWidgetFormInput(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
      'el_card_user_status' => new sfWidgetFormInput(),
      'id'                  => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'std_id'              => new sfValidatorInteger(),
      'class_id'            => new sfValidatorInteger(),
      'card_serial_number'  => new sfValidatorString(array('max_length' => 15)),
      'note'                => new sfValidatorString(array('required' => false)),
      'el_card_active_time' => new sfValidatorDateTime(),
      'el_card_status'      => new sfValidatorInteger(),
      'created_at'          => new sfValidatorDateTime(array('required' => false)),
      'updated_at'          => new sfValidatorDateTime(array('required' => false)),
      'el_card_user_status' => new sfValidatorInteger(array('required' => false)),
      'id'                  => new sfValidatorPropelChoice(array('model' => 'ElearningCard', 'column' => 'id', 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'ElearningCard', 'column' => array('card_serial_number')))
    );

    $this->widgetSchema->setNameFormat('elearning_card[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'ElearningCard';
  }


}
